package org.zn.etl.misc;

public enum DriverClassType {
	
	oracle("oracle","oracle.jdbc.OracleDriver"),
	mysql("mysql","com.mysql.cj.jdbc.Driver"),
	pg("postgresql","org.postgresql.Driver"),
	mssql("mssqlserver","com.microsoft.sqlserver.jdbc.SQLServerDriver");

	private String className;
	private String dbType; 
	

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public String getDbType() {
		return dbType;
	}

	public void setDbType(String dbType) {
		this.dbType = dbType;
	}

	DriverClassType(String dbType,String  className) {
		this.className=className;
		this.dbType=dbType;
	}
	
	
	public static String getClassName(String type){
		
		DriverClassType[] values = DriverClassType.values();
		
	        for (DriverClassType typeEnum:values) {
	        
	        	if(typeEnum.getDbType().equals(type)) {
	        	return 	typeEnum.getClassName();
	        	}	
	        }
			return null;
	}
	
	

}
